from machine import I2C,Pin
from ssd1306 import SSD1306_I2C

i2c = I2C(scl = Pin(16), sda=Pin(17))
oled = SSD1306_I2C(128, 64, i2c)

button_down = Pin(18, Pin.IN, Pin.PULL_UP)
button_click = Pin(13, Pin.IN, Pin.PULL_UP)

class App:
    name=""
    index=0
    def __init__(self, in_name, in_index):
        self.name = in_name
        self.index = in_index

    def runApp(self):
        print("run: "+self.name)
        oled.fill(0)
        txt = self.name+" running."
        oled.text(txt,int((128/2)-(len(txt)*8/2)),int((64/2)-(8/2)))
        oled.show()
        while(button_click.value() == 0):
            pass
        while(button_click.value() == 1):
            pass
